package dynamic_demo;

/**
 * 这是一个静态代理的例子
 *
 * @Author: Crystal
 * @Date: 2018/11/28 16:09
 **/
public class HelloStaticProxy implements Hello {

    private Hello hello;

    public HelloStaticProxy() {
        hello = new HelloImpl();
    }

    public void say(String name) {
        before();
        hello.say(name);
        after();
    }

    private void before() {
        System.out.println("##### Before ######");
    }

    private void after() {
        System.out.println("##### After ######");
    }

    public static void main(String[] args) {
        Hello helloProxy = new HelloStaticProxy();
        helloProxy.say("Static Cyy Proxy");
    }
}
